package com.buct.coder.core.assembler;

import com.buct.coder.facade.response.vo.StuContestLogVO;
import com.buct.coder.model.Contest;
import com.buct.coder.model.StudentContestLog;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * Created with IntelliJ IDEA.
 *
 * @Description:
 * @Auther: xinzi
 * @Date: 2022/08/18/15:11
 */
@Mapper
public interface BaseAssembler {

    BaseAssembler MAPPER = Mappers.getMapper(BaseAssembler.class);


    @Mapping(target = "id", source = "studentContestLog.id")
    @Mapping(target = "contestRank", source = "studentContestLog.contestRank")
    @Mapping(target = "performance", source = "studentContestLog.performance")
    @Mapping(target = "newRating", source = "studentContestLog.newRating")
    @Mapping(target = "diff", source = "studentContestLog.diff")
    @Mapping(target = "title", source = "contest.title")
    @Mapping(target = "link", source = "contest.link")
    @Mapping(target = "source", source = "contest.source")
    StuContestLogVO toContestLogVO(Contest contest, StudentContestLog studentContestLog);

}
